﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace VideoPlay.PhoneClient.Converters
{
    public class UrlStringToUriConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string url = value as string;

            Uri imageUri = null;
            if (!string.IsNullOrEmpty(url))
            {
                imageUri = new Uri(url, UriKind.Absolute);
            }
            else
            {
                //TODO: Set failed to load image
            }

            return imageUri;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
